<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/includes/common-import.jsp"%>
<%@ taglib uri="/page" prefix="p"%>

<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
	<meta charset="utf-8" />
	<title>${systemName}</title>
	<meta content="width=device-width, initial-scale=1.0" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<%@ include file="/WEB-INF/includes/common-component-edit.jsp"%>
</head>
<body class="page-header-fixed">
	<%@ include file="/WEB-INF/includes/header.jsp"%>
	<div class="page-container row-fluid">
		<%@ include file="/WEB-INF/includes/leftMenu.jsp"%>
		<div class="page-content">
			<div class="container-fluid">
				<div class="row-fluid">
					<div class="span12">
						<h3 class="page-title">
							教师评价体系管理
						</h3>
					</div>
				</div>
				<!-- END PAGE HEADER-->
				<!-- BEGIN PAGE CONTENT-->
				<div class="row-fluid">

					<div class="span12">

						<div class="portlet box blue" id="form_wizard_1">
							<div class="portlet-title">
								<div class="caption">
									<i class="icon-reorder"></i> 教师评价体系 -》第一步
								</div>
							</div>
							<div class="portlet-body form">
								<form id="inputForm" class="form-horizontal" action="${basePath}teacherExamSetting/${action}" method="post" >
									<div class="alert alert-error ${empty ERROR ?'hide':'' }">
										<button class="close" data-dismiss="alert"></button>
										<span>${ERROR }</span>
									</div>
									<div class="alert alert-success ${empty MESSAGE ?'hide':'' }">
										<button class="close" data-dismiss="alert"></button>
										<span>${MESSAGE }</span>
									</div>

									<div class="control-group">
									   <label class="control-label">
										   编码<span class="required">*</span>
									   </label>
									   <div class="controls">
										   <input id="code" name="code" class="span6 m-wrap required" type="text" value="${teacherExamSetting.code}">
									   </div>
									</div>
									<div class="control-group">
										<label class="control-label">
											评价体系名称<span class="required">*</span>
										</label>
										<div class="controls">
											<input id="name" name="name" class="span6 m-wrap required" type="text" value="${teacherExamSetting.name}">
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">
											描述<span class="required">*</span>
										</label>
										<div class="controls">
											<textarea id="content" name="content" style="width:50%;" cols="160" rows="4">${teacherExamSetting.content}</textarea>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">
											考核期间<span class="required">*</span>
										</label>
										<div class="controls">
											<c:choose>
												<c:when test="${hasResult > 0}">
													<input type="hidden" name="examDateId" value="${teacherExamSetting.examDateId}">
													<select id="examDateId" name="examDateId" class="span6 m-wrap required" disabled>
														<c:forEach items="${examDateList }" var="examDateList">
															<option value="${examDateList.id }" ${examDateList.id==teacherExamSetting.examDateId?'selected=selected':'' }>${examDateList.startdate }~${examDateList.enddate }（${examDateList.description }）</option>
														</c:forEach>
													</select>
												</c:when>
												<c:otherwise>
													<select id="examDateId" name="examDateId" class="span6 m-wrap required">
														<c:forEach items="${examDateList }" var="examDateList">
															<option value="${examDateList.id }" ${examDateList.id==teacherExamSetting.examDateId?'selected=selected':'' }>${examDateList.startdate }~${examDateList.enddate }（${examDateList.description }）</option>
														</c:forEach>
													</select>
												</c:otherwise>
											</c:choose>
										</div>
									</div>
									<div class="control-group">
										<div class="clearfix">
											<div class="btn-group">
												<c:if test="${hasResult == 0}">
													<a id="sample_editable_1_new" class="btn green" href="#" onclick="selectTeacher();">
														选择教师 <i class="icon-plus"></i>
													</a>
												</c:if>
											</div>
										</div>
										<c:if test="${ids ne '0'}">
											<table class="table table-striped table-bordered table-hover" id="sample_1">
												<thead>
												<tr>
													<th style="width:40px;">序号</th>
													<th>参评教师</th>
													<th>所属专业</th>
													<th>操作</th>
												</tr>
												</thead>
												<tbody>
												<c:forEach items="${list}" var="list" varStatus="status">
													<tr class="odd gradeX">
														<td>${status.count}</td>
														<td>${list.teacherName }</td>
														<td>${list.professional.proName }</td>
														<td>
															<c:if test="${hasResult == 0}">
																<a class="btn red" href="${basePath }teacherExamSetting/deleteTeacher/${list.id}/${teacherExamSetting.code}">
																	删除 <i class="icon-plus"></i>
																</a>
															</c:if>
														</td>
													</tr>
												</c:forEach>
												</tbody>
											</table>
											<p:page url="teacherExamSetting" cpage="${page.cpage }" perItem="${page.perItem }" totalItem="${page.totalItem }"/>
										</c:if>
									</div>
									<div class="form-actions clearfix">
										<button class="btn blue" type="button" onclick="nextStep();"><i class="icon-ok"></i>下一步</button>
										&nbsp;&nbsp;
										<a class="btn" onclick="cancle();">取消</a>

									</div>
								</form>
							</div>

						</div>

					</div>

				</div>
			</div>
		</div>
	</div>
	<script src="${resPath}media/js/app.js"></script>   
	<script>
		function cancle(){
			window.location = "${basePath}teacherExamSetting";
		}

		function selectTeacher(){
			$.dialog({
				id:'subWin1',
				title:'选择教师',
				width:750,
				height:450,
				fixed: true,
				lock:true,
				content:"url:${basePath }teacherExamSetting/selectTeacher/${ids}/${action}"
			});
		}

		function nextStep(){
			var ids = "${ids}";
			if($("#code").val() == ''){
				alert("编码不能为空！");
				return;
			}
			if($("#name").val() == ''){
				alert("评价体系名称不能为空！");
				return;
			}
			if($("#content").val() == ''){
				alert("描述不能为空！");
				return;
			}
			if(ids == '0'){
				alert("请选择评价教师！");
				return;
			}
			$("#inputForm").attr("action", "${basePath}teacherExamSetting/saveFirstStep/${teacherExamSetting.code}");
			$("#inputForm").submit();
		}
	</script>
</body>
</html>
